home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 15055 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  914 b 

  1. Path: uhura.phoenix.net!usenet
  2. From: brucew@phoenix.net (Bruce Wedding)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: About union
  5. Date: Tue, 16 Apr 1996 23:03:45 GMT
  6. Organization: BranPaul Systems
  7. Message-ID: <4l19a7$3ok@uhura.phoenix.net>
  8. References: <4kfj5g$24n@dewey.csun.edu> <smryanDpqCB7.F0w@netcom.com>
  9. NNTP-Posting-Host: dial141.phoenix.net
  10. X-Newsreader: Moe's Newsreader    
  11.  
  12. In comp.lang.c
  13. smryan@netcom.com (@#$%!?!) wrote:
  14.  
  15. I've often used, with no problems the following construct, or
  16. similar:
  17.  
  18. typedef union {
  19. unsigned char byte;
  20. unsigned int bit_0 : 1;
  21. unsigned int bit_1 : 1;
  22. unsigned int bit_2 : 1;
  23. unsigned int bit_3 : 1;
  24. unsigned int bit_4 : 1;
  25. unsigned int bit_5 : 1;
  26. unsigned int bit_6 : 1;
  27. unsigned int bit_7 : 1;
  28. } BIT;
  29.  
  30. It seems that, according to the standard, it is undefined
  31. behavior to access the individual bits, after assigning a
  32. character to byte.  Anyone have any thoughts on this?
  33.  
  34. Bruce
  35.  
  36.  
  37.